package com.xiaoxi.exam.dao;

import com.xiaoxi.exam.model.ToeflSchool;
import com.xiaoxi.exam.model.ToeflSchoolExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface ToeflSchoolMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table s_exam.t_toefl_school
     *
     * @mbg.generated Sat Nov 24 22:45:11 CST 2018
     */
    long countByExample(ToeflSchoolExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table s_exam.t_toefl_school
     *
     * @mbg.generated Sat Nov 24 22:45:11 CST 2018
     */
    int deleteByExample(ToeflSchoolExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table s_exam.t_toefl_school
     *
     * @mbg.generated Sat Nov 24 22:45:11 CST 2018
     */
    @Update({
        "update s_exam.t_toefl_school",
        "set deleted_at = now()",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table s_exam.t_toefl_school
     *
     * @mbg.generated Sat Nov 24 22:45:11 CST 2018
     */
    @Select({
        "insert into s_exam.t_toefl_school (province, city, ",
        "school, created_at, ",
        "updated_at, deleted_at)",
        "values (#{province,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR}, ",
        "#{school,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP}, ",
        "#{updatedAt,jdbcType=TIMESTAMP}, #{deletedAt,jdbcType=TIMESTAMP})", 
        " returning id"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    long insertReturningId(ToeflSchool record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table s_exam.t_toefl_school
     *
     * @mbg.generated Sat Nov 24 22:45:11 CST 2018
     */
    @Insert({
        "insert into s_exam.t_toefl_school (province, city, ",
        "school, created_at, ",
        "updated_at, deleted_at)",
        "values (#{province,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR}, ",
        "#{school,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP}, ",
        "#{updatedAt,jdbcType=TIMESTAMP}, #{deletedAt,jdbcType=TIMESTAMP})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insert(ToeflSchool record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table s_exam.t_toefl_school
     *
     * @mbg.generated Sat Nov 24 22:45:11 CST 2018
     */
    long insertSelectiveReturningId(ToeflSchool record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table s_exam.t_toefl_school
     *
     * @mbg.generated Sat Nov 24 22:45:11 CST 2018
     */
    int insertSelective(ToeflSchool record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table s_exam.t_toefl_school
     *
     * @mbg.generated Sat Nov 24 22:45:11 CST 2018
     */
    List<ToeflSchool> selectByExample(ToeflSchoolExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table s_exam.t_toefl_school
     *
     * @mbg.generated Sat Nov 24 22:45:11 CST 2018
     */
    @Select({
        "select",
        "id, province, city, school, created_at, updated_at, deleted_at",
        "from s_exam.t_toefl_school",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @ResultMap("com.xiaoxi.exam.dao.ToeflSchoolMapper.BaseResultMap")
    ToeflSchool selectByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table s_exam.t_toefl_school
     *
     * @mbg.generated Sat Nov 24 22:45:11 CST 2018
     */
    int updateByExampleSelective(@Param("record") ToeflSchool record, @Param("example") ToeflSchoolExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table s_exam.t_toefl_school
     *
     * @mbg.generated Sat Nov 24 22:45:11 CST 2018
     */
    int updateByExample(@Param("record") ToeflSchool record, @Param("example") ToeflSchoolExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table s_exam.t_toefl_school
     *
     * @mbg.generated Sat Nov 24 22:45:11 CST 2018
     */
    int updateByPrimaryKeySelective(ToeflSchool record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table s_exam.t_toefl_school
     *
     * @mbg.generated Sat Nov 24 22:45:11 CST 2018
     */
    @Update({
        "update s_exam.t_toefl_school",
        "set province = #{province,jdbcType=VARCHAR},",
          "city = #{city,jdbcType=VARCHAR},",
          "school = #{school,jdbcType=VARCHAR},",
          "created_at = #{createdAt,jdbcType=TIMESTAMP},",
          "updated_at = #{updatedAt,jdbcType=TIMESTAMP},",
          "deleted_at = #{deletedAt,jdbcType=TIMESTAMP}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(ToeflSchool record);
}